<?php
//奥特金仙
ini_set('default_socket_timeout', 3);
$web = @file_get_contents("https://esi.evepc.163.com/latest/status/");
if (!$web) {
    echo 'EVE正在维护或网络出现错误...';
}
$json = json_decode($web);
$err = json_last_error();
if ($err == JSON_ERROR_NONE) {
    $players = $json->players;
    //$vip=$json->vip;
    if (empty($json->vip)) {
        $date_str = $json->start_time;
        $server_version = $json->server_version;
        try {
            $date = new DateTime($date_str);
        } catch (Exception $e) {
        }
        /** @noinspection PhpUndefinedVariableInspection */
        $date->setTimezone(new DateTimeZone('Asia/Shanghai'));
        $formatted_date = $date->format('Y-m-d H:i:s');
        echo "<h1>EVE Online</h1><table border='3'><thead><tr><th>玩家数量</th><th>开服时间</th><th>版本号</th></tr></thead>
<tbody><tr><td>$players</td><td>$formatted_date</td><td>$server_version</td></tr></tbody></table>";
    } else {
        echo 'GM正在玩单机...';
    }
}